<?php

class Commerce {
  public static function login() {
    $uri = '/access/login';
    
    $request = new HTTPRequest( $baseURL.$url );
    
    $request->addHeader( 'Authorization', 'Basic '.base64_encode( $this->user.':'.$this->pass ) );
    
    $request->response = $request->request->process();
    
    if( $request->response )
      return json_decode( $request->response, true );
    else
      return false;
  }
  
  public static function register( $userdata ) {
    if( empty( $userdata['username'] ) || empty( $userdata['password'] ) || empty( $userdata['firstName'] ) || empty( $userdata['lastName'] ) || empty( $userdata['address'] ) )
      return false;
      
    $jsondata = json_encode( $userdata );
    
    $request->request = new HTTPRequest( $baseURL.$url, $jsondata, 'POST' );
    
    $request->response = $request->request->process();
    
    if( $request->response )
      return json_decode( $request->response, true );
    else
      return false;
  }
}
  
?>